#include <catch2/catch.hpp>

#include "solution.hpp"

TEST_CASE("034_find_first_and_last_position_of_element_in_sorted_array", "[034]") {
    CHECK(Solution().searchRange({5,7,7,8,8,10}, 8) == std::vector{3,4});
    CHECK(Solution().searchRange({5,7,7,8,8,10}, 6) == std::vector{-1,-1});
    CHECK(Solution().searchRange({5,7,7,8,8,10}, 5) == std::vector{0,0});
    CHECK(Solution().searchRange({5,7,7,8,8,10}, 10) == std::vector{5,5});
    CHECK(Solution().searchRange({}, 0) == std::vector{-1,-1});

    CHECK(Solution().searchRange({5,5,7,8,8,10}, 5) == std::vector{0,1});
    CHECK(Solution().searchRange({5,7,7,8,10,10}, 10) == std::vector{4,5});
    CHECK(Solution().searchRange({1,4}, 4) == std::vector{1,1});
    CHECK(Solution().searchRange({1,4}, 1) == std::vector{0,0});
}
